Skip to content

fix(cli): decode redirected Windows input as UTF-8 - #754

Open
rudycelekli wants to merge 1 commit into
Panniantong:mainfrom
rudycelekli:fix/agent-reach-windows-stdin-20261002
Open

rudycelekli wants to merge 1 commit into
Panniantong:mainfrom
rudycelekli:fix/agent-reach-windows-stdin-20261002

Conversation

@rudycelekli

Copy link
Copy Markdown

Problem

Windows Python can decode redirected stdin with an ANSI code page, while upstream tools emit UTF-8 JSON. The CLI currently changes stdout/stderr to UTF-8 but leaves stdin unchanged. A Chinese XHS title therefore becomes mojibake through agent-reach format xhs, even though parsing succeeds.

Changes

  • Reconfigure redirected Windows stdin to strict UTF-8 before reading it.
  • Preserve interactive console input, text-only streams and the existing pytest capture guard.
  • Report invalid UTF-8 as a clear format error with a failing exit status.

Verification

  • Native child processes with raw UTF-8 stdin and PYTHONIOENCODING=cp1252, using a simulated Windows platform: unchanged main produces corrupted title/description.
  • Focused regressions: unchanged main 2 failures and 3 controls; fixed branch 5 pass.
  • Full test suite: 612 passed; Ruff and diff whitespace checks pass.
  • Native Windows was not run; the code-page boundary is reproduced in real subprocesses on macOS with a simulated platform flag.
  • MyPy retains unchanged-main MCP SDK v2 errors; this change adds none.

AI-assisted implementation and tests, independently reviewed before submission.

Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com>
hbui290 added a commit to hbui290/Agent-Reach that referenced this pull request Oct 4, 2026
…g#747 Panniantong#589 Panniantong#762 Panniantong#717 Panniantong#754 + 10 low) (#14)

* fix(transcribe): keep ffmpeg off stdin and pass absolute paths (upstream Panniantong#769 Panniantong#770)

ffmpeg read the caller's stdin, so a 'q' there silently truncated the
audio. Relative names with ':' or a leading '-' were parsed as protocols
or options.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(uninstall): exit nonzero on failed cleanup, cover OPENCLAW_HOME and dangling links (upstream Panniantong#746 Panniantong#747)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs(skill): don't quote multi-word gh repo searches (upstream Panniantong#589)

A quoted multi-word query becomes an exact phrase and often returns 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(mcporter): accept comments and trailing commas in JSONC configs (upstream Panniantong#762)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(doctor): warn on undecodable cookies, ignore commented js-runtimes, honor HOME for yt-dlp config (upstream Panniantong#748 Panniantong#715 Panniantong#689)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(doctor): xiaoyuzhou checks ffprobe/curl/perl/python the script needs (upstream Panniantong#753)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(watch): report a failed update check instead of claiming latest (upstream Panniantong#653)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): read piped stdin as UTF-8 on Windows (upstream Panniantong#754)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(transcribe.sh): skip Python stubs that exist but cannot run (upstream Panniantong#717)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(boss): keep Windows profile path with spaces as one Chrome argument (upstream Panniantong#771)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(transcribe): write transcripts atomically and keep the text on write failure (upstream Panniantong#755)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): import Path for the atomic transcript writer

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(test.sh): install the checkout via relative path for Windows pip (upstream Panniantong#607)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: 0xharry <0xharry@0xharrys-MacBook-Pro.local>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant